#!usr/bin/python
# -*- coding: UTF-8 -*-
class A:
    pass  #占位符，啥都不干，光继承

class B(A): #继承A，B就是A的子类
    pass  #占位符，啥都不干，光继承B
print(issubclass(B, A))
print(issubclass(B, B)) #True 类是自身的子类
print(issubclass(B, object)) #True, object是所有类的基类

class C:
    pass  #占位符，啥都不干，光继承

print(issubclass(B, C))  #false

b1 = B()
print(isinstance(b1, B)) #True, b1是B的实例化对象，所以对的
print(isinstance(b1, A)) #True, b1是B的实例化对象，B类继承A类，所以对的
print(isinstance(b1, C)) #False, b1是B的实例化对象，C类继承B类，所以错的

class C:
    def __init__(self, x = 0):
        self.x = x

c1 = C()
print(hasattr(c1, 'x')) #True，一定要有字符串的标志

print(getattr(c1, 'x')) #

print(getattr(c1, 'y', '您所访问的属性不存在'))

print(setattr(c1, 'y', 'Fishc'))

print(delattr(c1, 'y')) #删除属性


class C:
    def __init__(self, size = 10):
        self.size = size
    def getSize(self):
        return self.size
    def setSize(self, value):
        self.size = value
    def delSize(self):
        del self.size
    x = property(getSize, setSize, delSize)

c1 = C()
print('c1.getSize()', c1.getSize())
c1.size = 18
print('c1.getSize()', c1.getSize())
del c1.size
#print('c1.getSize()', c1.getSize()) 不存在了









